// Called when the url of a tab changes.
function checkForValidUrl(tabId, changeInfo, tab) {
  if (tab.url.indexOf('photosight.ru/') > -1) {
    chrome.pageAction.show(tabId);
  }
};

// Start slide show
function showSlides(tab) {
  chrome.tabs.executeScript(null, {file: "jquery-1.10.2.min.js"});
  chrome.tabs.executeScript(null, {file: "jquery.cycle.all.js"});
  chrome.tabs.executeScript(null, {file: "slideshow.js"});
};

// Listen for any changes to the URL of any tab.
chrome.tabs.onUpdated.addListener(checkForValidUrl);
chrome.pageAction.onClicked.addListener(showSlides);

